const app = getApp();
Component({
  properties: {
    // 这里定义了innerText属性，属性值可以在组件使用时指定
    position: null,
    storeid: null
  },
  data: {
    timeProduct: {},
    displayPosition: 0,
    store: null,
    isShow: true,
    serverTime:""
  },
  ready: function () {
    var newPosition = this.data.position
    var newstore = this.data.storeid
    this.setData({ displayPosition: newPosition, store: newstore })
    if (this.data.store) {
      this.timeProductIndexList()
    }
  },

  methods: {
    //定时商品列表
    timeProductIndexList: function () {
      var that = this;
      wx.request({
        url: 'https://weapp.711688.net.cn/api/Store/TimeProductIndexList?storeId=' + app.globalData.storeId,
        success: function (res) {
          if (res.data.Code == 0) {
            if (res.data.Data.Setting.ShowIndex) {
              that.setData({
                timeProduct: res.data.Data,
                serverTime: res.data.ServerTime
              })
            }
          }
        },
      })
    },
    toTimeProductTap: function (e) {
      wx.navigateTo({
        url: "/pages/goods-details/index?id=" + e.currentTarget.dataset.id
      })
    },
  }
})